<?php



class MainMenu extends MX_Controller {
	function MainMenu()
	{
		parent::__construct();	
	}
	
	function index($seller_id="")
	{			
		$this->load->model("public_model");		
		
		// get main template with URL
		$webstoreObj=$this->public_model->getTemplateForUrl();
		$template=$webstoreObj['templatecode'];
		$templateUrl=base_url().'/application/views/templates/'.$template ;
		if(modules::run('login/is_admin_logged_in') == true || modules::run('login/is_seller_logged_in') == true) {
			$categoriesMenu = modules::run('categorysite/index',$seller_id);
		}
		else $categoriesMenu = null;
		
		$menu['templateUrl'] = $templateUrl;
		$menu['categoriesMenu'] = $categoriesMenu;		
		if(modules::run('login/is_admin_logged_in') == true) {
			$this->load->view('mainmenu_admin', $menu);
		}
		else if(modules::run('login/is_user_logged_in') == true) {
			$this->load->view('mainmenu_buyer', $menu);
		}
		else if(modules::run('login/is_seller_logged_in') == true) {
			if(modules::run('login/is_user_seller_logged_in') == true) {
				$seller=$this->public_model->getSellerById($this->session->userdata('sellerid'));
				$menu['seller']=$seller;
				$menu['sellerAccessType'] = 'user';
//				$this->load->view('mainmenu_seller', $menu);
			}
//			$seller=$this->public_model->getSellerById($this->session->userdata('sellerid'));
//			$menu['seller']=$seller;
			$this->load->view('mainmenu_seller', $menu);
		}
		
	}
}

/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */